Neil Brown [Mon, 14 May 2012 01:01:11 +0000 (11:01 +1000)]
Merge: allow merging a multi-patch patchfile.
If
wiggle -p -r patchfilename
is given, multiple patches - each identifying the target
file - are read from patchfilename and each is applied to the
relevant file. Note that '-r' is required with this usage of
-p.
Neil Brown [Sun, 13 May 2012 23:17:35 +0000 (09:17 +1000)]
main: only pass training args to extract/do_diff/do_merge.
subtract/add optind to argc/argv before passing along. That way
sub-functions don't need to access optind directly, and it will allow
us to pass other arg strings that are independent of optind.
Neil Brown [Fri, 11 May 2012 09:42:24 +0000 (19:42 +1000)]
Browser: improve decision on when to split window for merger view.
Now that we are tracking in_conflict in the broswer we "know" when
we are in a conflict and so can only display the split window then,
rather than keeping some hysteresis until we leave any changes behind.
This makes large jumps ('N' 'P') display better.
Also don't allow hunk headers to look like a 'wiggled' section, because
they aren't really.
Neil Brown [Fri, 11 May 2012 03:36:37 +0000 (13:36 +1000)]
Browse: avoid display problems when changing view-mode.
If we change mode so that the current end-of-line is no longer
visible, the display gets confused and add extra lines. So when mode
changes, move backward then forward to ensure we are on a visibile
line.
Neil Brown [Thu, 10 May 2012 07:09:52 +0000 (17:09 +1000)]
isolate_conflicts: don't look for eol that cannot be there.
When looking for 'wiggles' we need to track whole lines
in the original file. But when looking for an end-of-line
we shouldn't look at an merge-item that doesn't even
exist in the original file.
Reported-by: Chris Peterson <cpeterso@cpeterso.com> Signed-off-by: NeilBrown <neilb@suse.de>
Neil Brown [Thu, 10 May 2012 06:44:07 +0000 (16:44 +1000)]
Browser: add a more effective cursor.
Create a proper cursor structure to track where on the screen we are.
Record the width of the current symbol so 'backward' works better.
Allow movement master start and end of line by going to previous or
next line.
Allow 'search' to locate the actual string, not just the line.
Neil Brown [Tue, 8 May 2012 09:56:38 +0000 (19:56 +1000)]
merge: avoid including large Unmatched sections in a conflict.
A large Unmatched section can just distract from the real conflict
and doesn't give useful information.
So if we can close the conflict before a big Unmatched,
do so.
Neil Brown [Tue, 8 May 2012 08:54:11 +0000 (18:54 +1000)]
Encourage more context into conflict reports.
Conflict reports currently don't contain much surrounding
'Extraneous' text. When the patch didn't really apply at all,
this context is very useful.
So encourage at least 3 lines of context from Extraneous or
Unchanged texts.
If it mostly comes from Unchanged text it isn't quite so useful,
so reduce the requirement.
Update self-tests to match. In most cases these are an improvement.
In a couple of case we maybe get a bit more context than really
necessary, but that is better than not enough.
Neil Brown [Tue, 8 May 2012 07:09:07 +0000 (17:09 +1000)]
Improve handling of hunk-header when merging.
If we are merging a patch, the patch will contain a number of
hunk-headers (essentially the @@ NN,MM @@) lines.
These should never appear in the merge, and must always line up with
end-of-line in the original as they represent a number of lines having
been deleted.
So:
Cause these to each create a simple Extraneous merger, never
combined with adjacent texts
exclude them from any conflicts in isolate_conflict, so they
can never appear in a merge
Ensure that a preceeding 'Unmatched' finishes on an end-of-line.
Also update lots of self tests with improved results.
Neil Brown [Tue, 8 May 2012 06:18:31 +0000 (16:18 +1000)]
Ensure that a hunk-header never appears in the middle of an Extraneous range.
A hunk header is always Extraneous. However Extraneous text before it is
quite separate and is best kept separate.
Start a new Extraneous merger with each hunk header will make it easier
to detect hunk headers and handle them better.
Neil Brown [Mon, 7 May 2012 21:59:27 +0000 (07:59 +1000)]
Add --show-wiggle flag.
--show-wiggle modifies --merge so that chunks which need to be
wiggled into place are presented as full conflicts with an
extra stanza which shows what the resulting wiggle would look like.
Neil Brown [Mon, 7 May 2012 21:59:27 +0000 (07:59 +1000)]
Introduce xmalloc and use it.
Instead of sometimes calling die() when malloc fails and
sometimes not, introduce xmalloc() which always reports a message
and dies, and use it uniformly.
Neil Brown [Mon, 22 Aug 2011 08:08:02 +0000 (18:08 +1000)]
nul terminate stream read from a file.
Though we carry around the length of a string and so will not normally
need a nul terminator, we sometimes use sscanf which cannot take a
length and so needs nul termination.
Neil Brown [Mon, 22 Aug 2011 04:28:20 +0000 (14:28 +1000)]
Make lots of functions "static".
In particular isolate_conflicts() needs to be static to avoid a link
error with SUN's C compiler Reported-by: Oliver Kiddle <oliver@kiddle.eu>
Also this shows that set_prefix() wasn't being used any more, so fix
that.
Neil Brown [Wed, 12 May 2010 06:31:57 +0000 (16:31 +1000)]
More options for giving patches to --browse
As well as a 'patch' file (which identifies the target file by
names in the patch file), you can now also browse given a
target file plus a diff,
just the diff if it ends '.rej',
a target file plus old and new versions of the file.
Neil Brown [Fri, 2 Apr 2010 04:31:59 +0000 (15:31 +1100)]
Significant browser update.
wiggle -B
is getting closer to what I wanted. Lots of dead code removed
and lots of fine details tidied up.
Usage is a bit different in that we don't always see a split
window.
Various sundry changes like .gitignore and "make demo.path"